package com.ex.shapecalc;

import com.ex.question.base.ShapeQuestion;

public class HeartQuestion extends ShapeQuestion { 
	TriangleQuestion mDownTriangle; 
	CircleQuestion mUpCircle;
	
	public HeartQuestion(){
		mQuestionTypeName = "心形面积计算";  
		createQuestion();
	}
	public HeartQuestion(TriangleQuestion tri, CircleQuestion c)
	{
		createQuestion(tri, c); 
	}
	
	public HeartQuestion(int l,int h )
	{
		mQuestionTypeName = "心形面积计算"; 
		createQuestion(l, h); 
	} 
	
	public void CalcArea(){
		mArea = mDownTriangle.getRightArea() + mUpCircle.getRightArea();
	}
	public void CalcPerimeter(){
		mPerimeter = mDownTriangle.getRightPerimeter() + mUpCircle.getRightPerimeter() - mDownTriangle.mHeight;
	} 
	
 
	public TriangleQuestion getmDownTriangle() {
		return mDownTriangle;
	}
	public void setmDownTriangle(TriangleQuestion mDownTriangle) {
		this.mDownTriangle = mDownTriangle;
	}
 
	public void createQuestion() {
		createQuestion( mRand.getRandom10() * 2 ,
				mRand.getRandom10() + 3);
	}
	public void createQuestion(int l, int h){ 
		mDownTriangle = new TriangleQuestion(l, h);
		mUpCircle = new CircleQuestion(l / 2);
		createQuestion(mDownTriangle, mUpCircle);		
	}
	
	public void createQuestion(TriangleQuestion tri, CircleQuestion c)
	{
		mDownTriangle = tri;
		mUpCircle = c; 
		CalcArea();
		CalcPerimeter();
	}
	 
}
